<template>
  <el-card>
    <el-table :data="Applist" border stripe>
      <el-table-column type="index" label="#" />
      <el-table-column label="项目名称" prop="name" />
      <el-table-column label="创建时间" prop="createTime" />
      <el-table-column label="操作" width="180px">
        <template slot-scope="scope">
          <!-- 修改按钮 -->
          <el-button size="mini" type="text" @click="xq(scope.row)"
            >造价录入</el-button
          >
          <el-button size="mini" type="text" @click="handleStore(scope.row.id)"
            >材料录入</el-button
          >
          <!-- icon="el-icon-edit" -->
        </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script>
import { getapplist } from "../api/user";
export default {
  data() {
    return {
      Applist: [],
      id: "",
    };
  },
  created() {
    this.id = localStorage.getItem("id");
    this.applist();
  },
  methods: {
    async applist() {
      const res = await getapplist(this.id);
      if (res.code == 200) {
        this.Applist = res.data;
        console.log(res, "当前用户项目");
      }
    },
    xq(row) {
      console.log(row, "aaaaaaaaaaaa");
      this.$router.push({ path: "/xiangmu/xq", query: { id: row.id } });
    },

    handleStore(d) {
      console.log(d, "12345613213456");
      this.$router.push({ path: "/storelist", query: { id: d } });
    },
  },
};
</script>

<style scoped>
.el-table {
  max-width: 70%;
  min-width: 50%;
  margin: 0 auto;
}
</style>